public class CQuick
{
	public static void quicksort(CSequence tablica[], int x, int y)
	{
		int i,j,v;
		CSequence temp;
		
		i=x;
		j=y;
		v=tablica[(x+y) / 2].soc_SetOfCards.getValue();
		
		do 
		{
			while (tablica[i].soc_SetOfCards.getValue()>v) {i++;}
			
			while (v>tablica[j].soc_SetOfCards.getValue()) {j--;}
			
			if (i<=j)
			{
				temp=tablica[i];
				tablica[i]=tablica[j];
				tablica[j]=temp;
				i++;
				j--;
			}
		} while (i<=j);
		
		if (x<j) {quicksort(tablica,x,j);}
		
		if (i<y) {quicksort(tablica,i,y);}
	}
	
	public static void quicksort(CCard tablica[], int x, int y)
	{
		int i,j,v;
		CCard temp;
		
		i=x;
		j=y;
		v=tablica[(x+y) / 2].getIntegerValueOfCard();
		
		do 
		{
			while (tablica[i].getIntegerValueOfCard()>v) {i++;}
			
			while (v>tablica[j].getIntegerValueOfCard()) {j--;}
			
			if (i<=j)
			{
				temp=tablica[i];
				tablica[i]=tablica[j];
				tablica[j]=temp;
				i++;
				j--;
			}
		} while (i<=j);
		
		if (x<j) {quicksort(tablica,x,j);}
		
		if (i<y) {quicksort(tablica,i,y);}
	}
	
	public static void quicksort(int tablica[], int x, int y)
	{
		int i,j,v;
		int temp;
		
		i=x;
		j=y;
		v=tablica[(x+y) / 2];
		
		do 
		{
			while (tablica[i]>v) {i++;}
			
			while (v>tablica[j]) {j--;}
			
			if (i<=j)
			{
				temp=tablica[i];
				tablica[i]=tablica[j];
				tablica[j]=temp;
				i++;
				j--;
			}
		} while (i<=j);
		
		if (x<j) {quicksort(tablica,x,j);}
		
		if (i<y) {quicksort(tablica,i,y);}
	}
}